home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / sunprom / RCS / fs.c,v < prev    next >
Encoding:
Text File  |  1990-11-27  |  17.7 KB  |  845 lines

  1. head     1.11;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.11
  10. date     90.11.27.11.17.26;  author jhh;  state Exp;
  11. branches ;
  12. next     1.10;
  13.  
  14. 1.10
  15. date     90.07.17.15.42.24;  author mendel;  state Exp;
  16. branches ;
  17. next     1.9;
  18.  
  19. 1.9
  20. date     89.06.16.08.29.57;  author brent;  state Exp;
  21. branches ;
  22. next     1.8;
  23.  
  24. 1.8
  25. date     89.01.06.08.14.31;  author brent;  state Exp;
  26. branches ;
  27. next     1.7;
  28.  
  29. 1.7
  30. date     87.05.19.12.14.02;  author brent;  state Exp;
  31. branches ;
  32. next     1.6;
  33.  
  34. 1.6
  35. date     87.05.11.11.16.35;  author brent;  state Exp;
  36. branches ;
  37. next     1.5;
  38.  
  39. 1.5
  40. date     87.05.08.17.44.41;  author brent;  state Exp;
  41. branches ;
  42. next     1.4;
  43.  
  44. 1.4
  45. date     86.07.24.11.32.59;  author brent;  state Exp;
  46. branches ;
  47. next     1.3;
  48.  
  49. 1.3
  50. date     86.07.21.09.35.02;  author brent;  state Exp;
  51. branches ;
  52. next     1.2;
  53.  
  54. 1.2
  55. date     86.07.18.11.58.21;  author nelson;  state Exp;
  56. branches ;
  57. next     1.1;
  58.  
  59. 1.1
  60. date     86.07.18.09.32.17;  author brent;  state Exp;
  61. branches ;
  62. next     ;
  63.  
  64.  
  65. desc
  66. @Boot time filesystem utilities
  67. @
  68.  
  69.  
  70. 1.11
  71. log
  72. @got it to compile, moved location for sun3 kernel
  73. @
  74. text
  75. @/* fs.c -
  76.  *
  77.  *    General filesystem support.
  78.  *
  79.  * Copyright (C) 1985 Regents of the University of California
  80.  * All rights reserved.
  81.  */
  82.  
  83. #ifdef notdef
  84. static char rcsid[] = "$Header: /sprite/src/boot/sunprom/RCS/fs.c,v 1.10 90/07/17 15:42:24 mendel Exp Locker: jhh $ SPRITE (Berkeley)";
  85. #endif not lint
  86.  
  87. #include "sprite.h"
  88. #include "fsBoot.h"
  89. #include "machMon.h"
  90. #include "ofs.h"
  91.  
  92. /*
  93.  * For non-block aligned reads.
  94.  */
  95. char    readBuffer[FS_BLOCK_SIZE];
  96.  
  97. /*
  98.  * For lookup
  99.  */
  100. static char    component[FS_MAX_NAME_LENGTH];
  101.  
  102. /*
  103.  * Forward declarations.
  104.  */
  105. void FsGetFileDesc();
  106. void FsInitFileHandle();
  107.  
  108. /*
  109.  * ----------------------------------------------------------------------------
  110.  *
  111.  * Open --
  112.  *
  113.  *    Open a file.  This does a simple lookup (based on the kernel's
  114.  *    FsLocalLookup) and creates a handle for the file.
  115.  *
  116.  * Results:
  117.  *    SUCCESS or a return code from various sub-operations.
  118.  *
  119.  * Side effects:
  120.  *    Calls malloc
  121.  *
  122.  * ----------------------------------------------------------------------------
  123.  */
  124.  
  125. ReturnStatus
  126. Open(fileName, useFlags, permissions, handlePtrPtr)
  127.     char *fileName;
  128.     int useFlags;
  129.     int permissions;
  130.     Fsio_FileIOHandle     **handlePtrPtr;
  131. {
  132.     register ReturnStatus status;
  133.     Fsio_FileIOHandle *curHandlePtr;
  134.     register char *curCharPtr;
  135.     register char *componentPtr;
  136.     register int index;
  137.  
  138.     curCharPtr = fileName;
  139.     while(*curCharPtr == '/') {
  140.     curCharPtr++;
  141.     }
  142.     curHandlePtr = fsRootHandlePtr;
  143.  
  144.     while (*curCharPtr != '\0') {
  145.     if (curHandlePtr->descPtr->fileType != FS_DIRECTORY) {
  146.         return(FS_NOT_DIRECTORY);
  147.     }
  148.         /*
  149.          * Get the next component.
  150.          */
  151.         index = 0;
  152.     componentPtr = component;
  153.         while (*curCharPtr != '/' && *curCharPtr != '\0') {
  154.             *componentPtr++ = *curCharPtr++;
  155.         }
  156.         *componentPtr = '\0';
  157. #ifndef NO_PRINTF
  158.     Mach_MonPrintf(" %s ", component);
  159. #endif
  160.         /*
  161.          * Skip intermediate and trailing slashes so that *curCharPtr
  162.          * is Null when 'component' has the last component of the name.
  163.          */
  164.         while (*curCharPtr == '/') {
  165.             curCharPtr++;
  166.         }
  167.  
  168.     status = FsFindComponent(fsDomainPtr, curHandlePtr, component,
  169.                           &curHandlePtr);
  170.  
  171.     if (status != SUCCESS) {
  172. #ifndef NO_PRINTF
  173.         Mach_MonPrintf("<%x>\n", status);
  174. #endif
  175.         return(status);
  176.     }
  177.     }
  178.     *handlePtrPtr = curHandlePtr;
  179.     return status;
  180. }
  181.  
  182. /*
  183.  * ----------------------------------------------------------------------------
  184.  *
  185.  * Read --
  186.  *
  187.  *    Read from a file given its handle.
  188.  *
  189.  * Results:
  190.  *    A return status from the read.
  191.  *
  192.  * Side effects:
  193.  *    buffer is loaded with the data read in.
  194.  *    *readCountPtr is updated to reflect the number of bytes read.
  195.  *
  196.  * ----------------------------------------------------------------------------
  197.  */
  198. ReturnStatus
  199. Read(handlePtr, offset, numBytes, buffer, readCountPtr)
  200.     register Fsio_FileIOHandle     *handlePtr;
  201.     int            offset;
  202.     int            numBytes;
  203.     register Address    buffer;
  204.     int            *readCountPtr;
  205. {
  206.     int                firstBlock;
  207.     int                lastBlock;
  208.     int                lastByte;
  209.     BlockIndexInfo        indexInfo;
  210.     register    int        readSize;
  211.     register    int        blockAddr;
  212.     register    int        blockOffset;
  213.     register    int        bufferIndex;
  214.     register     ReturnStatus    status;
  215.     register    int        size;
  216.  
  217.     firstBlock = offset / FS_BLOCK_SIZE; 
  218.     lastByte = offset + numBytes - 1;
  219.     if (lastByte > handlePtr->descPtr->lastByte) {
  220.     lastByte = handlePtr->descPtr->lastByte;
  221.     }
  222.     lastBlock = lastByte / FS_BLOCK_SIZE;
  223.  
  224.     (void)FsGetFirstIndex(handlePtr, firstBlock, &indexInfo);
  225.  
  226.     bufferIndex = 0;
  227.     blockOffset = offset & FS_BLOCK_OFFSET_MASK;
  228. #ifdef SCSI0_BOOT 
  229.     Mach_MonPrintf(" read %d at %d into %x\n", numBytes, offset, buffer);
  230. #endif 
  231.  
  232.     while (indexInfo.blockNum <= lastBlock) {
  233.     if (indexInfo.blockNum < lastBlock) {
  234.         size = FS_BLOCK_SIZE - blockOffset;
  235.         readSize = FS_BLOCK_SIZE;
  236.     } else {
  237.         size = (lastByte & FS_BLOCK_OFFSET_MASK) + 1 - blockOffset;
  238.         readSize = size;
  239.     }
  240.     blockAddr = *indexInfo.blockAddrPtr + 
  241.     ((Ofs_DomainHeader *) fsDomainPtr->clientData)->dataOffset *
  242.         FS_FRAGMENTS_PER_BLOCK;
  243.     if (blockOffset != 0 || size != FS_BLOCK_SIZE) { 
  244.         status = FsDeviceBlockIO(FS_READ, &fsDevice, blockAddr,
  245.                (readSize - 1) / FS_FRAGMENT_SIZE + 1, readBuffer);
  246.         if (status != SUCCESS) {
  247.         goto readError;
  248.         }
  249.         bcopy(&(readBuffer[blockOffset]), &(buffer[bufferIndex]), size);
  250.     } else {
  251.         status = FsDeviceBlockIO(FS_READ, &fsDevice, blockAddr,
  252.             FS_FRAGMENTS_PER_BLOCK, &(buffer[bufferIndex]));
  253.         if (status != SUCCESS) {
  254.         goto readError;
  255.         }
  256.     }
  257.     bufferIndex += size;
  258.     blockOffset = 0;
  259.     FsGetNextIndex(handlePtr, &indexInfo);
  260.     }
  261.  
  262. readError:
  263.  
  264.     *readCountPtr = bufferIndex;
  265.  
  266.     return(status);
  267. }
  268.  
  269. /*
  270.  *----------------------------------------------------------------------
  271.  *
  272.  * FsFindComponent --
  273.  *
  274.  *
  275.  * Results:
  276.  *    None.
  277.  *
  278.  * Side effects:
  279.  *
  280.  *----------------------------------------------------------------------
  281.  */
  282. ReturnStatus
  283. FsFindComponent(domainPtr, curHandlePtr, component, newHandlePtrPtr)
  284.     Fsdm_Domain *domainPtr;
  285.     Fsio_FileIOHandle *curHandlePtr;
  286.     char *component;
  287.     Fsio_FileIOHandle **newHandlePtrPtr;
  288. {
  289.     register ReturnStatus status;
  290.     register int dirOffset;        /* Offset within the directory */
  291.     register int blockOffset;        /* Offset within a directory block */
  292.     register Fslcl_DirEntry *dirEntryPtr;    /* Reference to directory entry */
  293.     int length;                /* Length variable for read call */
  294.     register Fsio_FileIOHandle *handlePtr;
  295.  
  296.     dirOffset = 0;
  297.     do {
  298.     length = FSLCL_DIR_BLOCK_SIZE;
  299.     status = Read(curHandlePtr, dirOffset, length, readBuffer, &length);
  300.     if (status != SUCCESS) {
  301.         return(status);
  302.     }
  303.     if (length == 0) {
  304.         return(FS_FILE_NOT_FOUND);
  305.     }
  306.     dirEntryPtr = (Fslcl_DirEntry *)readBuffer;
  307.     blockOffset = 0;
  308.     while (blockOffset < FSLCL_DIR_BLOCK_SIZE) {
  309.         dirEntryPtr = (Fslcl_DirEntry *)((int)readBuffer + blockOffset);
  310.         if (dirEntryPtr->fileNumber != 0) {
  311.         /*
  312.          * A valid directory record.
  313.          */
  314. #ifndef NO_PRINTF
  315.         Mach_MonPrintf("Found %s\n", dirEntryPtr->fileName);
  316. #endif NO_PRINTF
  317.         if (strcmp(component, dirEntryPtr->fileName) == 0) {
  318.             handlePtr = (Fsio_FileIOHandle *)malloc(sizeof(Fsio_FileIOHandle));
  319.             FsInitFileHandle(domainPtr, dirEntryPtr->fileNumber,
  320.                     handlePtr);
  321.             *newHandlePtrPtr = handlePtr;
  322.             return(SUCCESS);
  323.         }
  324.         }
  325.         blockOffset += dirEntryPtr->recordLength;
  326.     }
  327.     dirOffset += FSLCL_DIR_BLOCK_SIZE;
  328.     } while(TRUE);
  329. }
  330.  
  331. /*
  332.  *----------------------------------------------------------------------
  333.  *
  334.  * FsInitFileHandle --
  335.  *
  336.  *    Initialize a file handle.
  337.  *
  338.  * Results:
  339.  *    None.
  340.  *
  341.  * Side effects:
  342.  *    Fills in the file handle that our caller has already allocated.
  343.  *
  344.  *----------------------------------------------------------------------
  345.  */
  346. void
  347. FsInitFileHandle(domainPtr, fileNumber, handlePtr)
  348.     Fsdm_Domain *domainPtr;
  349.     int fileNumber;
  350.     register Fsio_FileIOHandle *handlePtr;
  351. {
  352.     register Fsdm_FileDescriptor *descPtr;
  353.  
  354.     bzero((Address)handlePtr, sizeof(Fsio_FileIOHandle));
  355.     handlePtr->hdr.fileID.minor = fileNumber;
  356.     descPtr = (Fsdm_FileDescriptor *)malloc(sizeof(Fsdm_FileDescriptor));
  357.     FsGetFileDesc(domainPtr, fileNumber, descPtr);
  358.     handlePtr->descPtr = descPtr;
  359. }
  360.  
  361. /*
  362.  *----------------------------------------------------------------------
  363.  *
  364.  * FsGetFileDesc --
  365.  *
  366.  *    Read in a file descriptor from the disk.
  367.  *
  368.  * Results:
  369.  *    None.
  370.  *
  371.  * Side effects:
  372.  *    Fills in the file descriptor that our caller has already allocated.
  373.  *
  374.  *----------------------------------------------------------------------
  375.  */
  376. void
  377. FsGetFileDesc(domainPtr, fileNumber, descPtr)
  378.     Fsdm_Domain *domainPtr;
  379.     register int fileNumber;
  380.     register Fsdm_FileDescriptor *descPtr;
  381. {
  382.     register Ofs_DomainHeader *headerPtr;
  383.     register int         blockNum;
  384.     register int         offset;
  385.  
  386.     headerPtr = ((Ofs_DomainHeader *) domainPtr->clientData);
  387.     blockNum = headerPtr->fileDescOffset + fileNumber / FSDM_FILE_DESC_PER_BLOCK;
  388.     offset = (fileNumber & (FSDM_FILE_DESC_PER_BLOCK - 1)) *
  389.         FSDM_MAX_FILE_DESC_SIZE;
  390.  
  391.     (void)FsDeviceBlockIO(FS_READ, &fsDevice, 
  392.                blockNum * FS_FRAGMENTS_PER_BLOCK,
  393.                FS_FRAGMENTS_PER_BLOCK, readBuffer);
  394.     bcopy( readBuffer + offset, (char *) descPtr, sizeof(Fsdm_FileDescriptor));
  395. #ifndef NO_PRINTF
  396.     if (descPtr->magic != FS_FD_MAGIC) {
  397.     Mach_MonPrintf("desc %d bad <%x>\n", fileNumber, descPtr->magic);
  398.     }
  399. #endif
  400. }
  401. @
  402.  
  403.  
  404. 1.10
  405. log
  406. @*** empty log message ***
  407. @
  408. text
  409. @d10 1
  410. a10 1
  411. static char rcsid[] = "$Header: /sprite/src/boot/scsiDiskBoot/RCS/fs.c,v 1.9 89/06/16 08:29:57 brent Exp $ SPRITE (Berkeley)";
  412. d16 1
  413. d37 1
  414. a37 1
  415.  * Fs_Open --
  416. d52 1
  417. a52 1
  418. Fs_Open(fileName, useFlags, permissions, handlePtrPtr)
  419. d111 1
  420. a111 1
  421.  * Fs_Read --
  422. d125 1
  423. a125 1
  424. Fs_Read(handlePtr, offset, numBytes, buffer, readCountPtr)
  425. d167 2
  426. a168 1
  427.             fsDomainPtr->headerPtr->dataOffset * FS_FRAGMENTS_PER_BLOCK;
  428. d225 1
  429. a225 1
  430.     status = Fs_Read(curHandlePtr, dirOffset, length, readBuffer, &length);
  431. d308 1
  432. a308 1
  433.     register Fsdm_DomainHeader *headerPtr;
  434. d312 1
  435. a312 1
  436.     headerPtr = domainPtr->headerPtr;
  437. d320 1
  438. a320 1
  439.     bcopy( readBuffer + offset, descPtr, sizeof(Fsdm_FileDescriptor));
  440. @
  441.  
  442.  
  443. 1.9
  444. log
  445. @Updated to the new device interface
  446. @
  447. text
  448. @d10 1
  449. a10 1
  450. static char rcsid[] = "$Header: /sprite/src/boot/scsiDiskBoot/RCS/fs.c,v 1.8 89/01/06 08:14:31 brent Exp $ SPRITE (Berkeley)";
  451. a31 1
  452. #undef NO_PRINTF
  453. d55 1
  454. a55 1
  455.     FsLocalFileIOHandle     **handlePtrPtr;
  456. d58 1
  457. a58 1
  458.     FsLocalFileIOHandle *curHandlePtr;
  459. d104 1
  460. d125 1
  461. a125 1
  462.     register FsLocalFileIOHandle     *handlePtr;
  463. d153 1
  464. a153 1
  465. #ifdef notdef 
  466. d155 1
  467. a155 1
  468. #endif notdef 
  469. d208 2
  470. a209 2
  471.     FsDomain *domainPtr;
  472.     FsLocalFileIOHandle *curHandlePtr;
  473. d211 1
  474. a211 1
  475.     FsLocalFileIOHandle **newHandlePtrPtr;
  476. d216 1
  477. a216 1
  478.     register FsDirEntry *dirEntryPtr;    /* Reference to directory entry */
  479. d218 1
  480. a218 1
  481.     register FsLocalFileIOHandle *handlePtr;
  482. d222 1
  483. a222 1
  484.     length = FS_DIR_BLOCK_SIZE;
  485. d230 1
  486. a230 1
  487.     dirEntryPtr = (FsDirEntry *)readBuffer;
  488. d232 2
  489. a233 2
  490.     while (blockOffset < FS_DIR_BLOCK_SIZE) {
  491.         dirEntryPtr = (FsDirEntry *)((int)readBuffer + blockOffset);
  492. d238 1
  493. d240 1
  494. d242 1
  495. a242 1
  496.             handlePtr = (FsLocalFileIOHandle *)malloc(sizeof(FsLocalFileIOHandle));
  497. d251 1
  498. a251 1
  499.     dirOffset += FS_DIR_BLOCK_SIZE;
  500. d272 1
  501. a272 1
  502.     FsDomain *domainPtr;
  503. d274 1
  504. a274 1
  505.     register FsLocalFileIOHandle *handlePtr;
  506. d276 1
  507. a276 1
  508.     register FsFileDescriptor *descPtr;
  509. d278 1
  510. a278 1
  511.     bzero((Address)handlePtr, sizeof(FsLocalFileIOHandle));
  512. d280 1
  513. a280 1
  514.     descPtr = (FsFileDescriptor *)malloc(sizeof(FsFileDescriptor));
  515. d302 1
  516. a302 1
  517.     FsDomain *domainPtr;
  518. d304 1
  519. a304 1
  520.     register FsFileDescriptor *descPtr;
  521. d306 1
  522. a306 1
  523.     register FsDomainHeader *headerPtr;
  524. d311 3
  525. a313 3
  526.     blockNum = headerPtr->fileDescOffset + fileNumber / FS_FILE_DESC_PER_BLOCK;
  527.     offset = (fileNumber & (FS_FILE_DESC_PER_BLOCK - 1)) *
  528.         FS_MAX_FILE_DESC_SIZE;
  529. d318 1
  530. a318 1
  531.     bcopy( readBuffer + offset, descPtr, sizeof(FsFileDescriptor));
  532. @
  533.  
  534.  
  535. 1.8
  536. log
  537. @New include files and constants due to source reorganization
  538. @
  539. text
  540. @d9 2
  541. a10 2
  542. #ifndef lint
  543. static char rcsid[] = "$Header: fs.c,v 1.7 87/05/19 12:14:02 brent Exp $ SPRITE (Berkeley)";
  544. d14 2
  545. a15 4
  546. #include "fs.h"
  547. #include "fsDisk.h"
  548. #include "fsIndex.h"
  549. #include "fsOpTable.h"
  550. a17 7
  551.  * Things set up by Fs_AttachDisk
  552.  */
  553. extern    Fs_Device    fsDevice;
  554. extern    FsDomain    *fsDomainPtr;
  555. extern    FsHandle    *fsRootHandlePtr;
  556.  
  557. /*
  558. d32 1
  559. a32 1
  560.  
  561. d46 1
  562. a46 1
  563.  *    Calls Mem_Alloc
  564. d56 1
  565. a56 1
  566.     FsHandle     **handlePtrPtr;
  567. d59 1
  568. a59 1
  569.     FsHandle *curHandlePtr;
  570. d71 1
  571. a71 1
  572.     if (curHandlePtr->fileType != FS_DIRECTORY) {
  573. d84 1
  574. a84 1
  575.     Sys_Printf(" %s ", component);
  576. d99 1
  577. a99 1
  578.         Sys_Printf("<%x>\n", status);
  579. d125 1
  580. a125 1
  581.     register FsHandle     *handlePtr;
  582. d144 2
  583. a145 2
  584.     if (lastByte > handlePtr->lastByte) {
  585.     lastByte = handlePtr->lastByte;
  586. d154 1
  587. a154 1
  588.     Sys_Printf(" read %d at %d into %x\n", numBytes, offset, buffer);
  589. d168 1
  590. a168 1
  591.         status = FsBlockIO(FS_READ, &handlePtr->device, blockAddr,
  592. d173 1
  593. a173 1
  594.         Byte_Copy(size, &(readBuffer[blockOffset]), &(buffer[bufferIndex]));
  595. d175 1
  596. a175 1
  597.         status = FsBlockIO(FS_READ, &handlePtr->device, blockAddr,
  598. d209 1
  599. a209 1
  600.     FsHandle *curHandlePtr;
  601. d211 1
  602. a211 1
  603.     FsHandle **newHandlePtrPtr;
  604. d218 1
  605. a218 1
  606.     register FsHandle *handlePtr;
  607. d238 3
  608. a240 2
  609.         if (String_Compare(component, dirEntryPtr->fileName) == 0) {
  610.             handlePtr = (FsHandle *)Mem_Alloc(sizeof(FsHandle));
  611. d272 1
  612. a272 1
  613.     register FsHandle *handlePtr;
  614. d276 3
  615. a278 3
  616.     Byte_Zero(sizeof(FsHandle), (Address)handlePtr);
  617.     handlePtr->fileNumber = fileNumber;
  618.     descPtr = (FsFileDescriptor *)Mem_Alloc(sizeof(FsFileDescriptor));
  619. a280 3
  620.     handlePtr->device = fsDevice;
  621.     handlePtr->fileType = descPtr->fileType;
  622.     handlePtr->lastByte = descPtr->lastByte;
  623. d313 1
  624. a313 1
  625.     (void)FsBlockIO(FS_READ, &headerPtr->device, 
  626. d316 1
  627. a316 1
  628.     Byte_Copy(sizeof(FsFileDescriptor), readBuffer + offset, descPtr);
  629. d319 1
  630. a319 1
  631.     Sys_Printf("desc %d bad <%x>\n", fileNumber, descPtr->magic);
  632. @
  633.  
  634.  
  635. 1.7
  636. log
  637. @More trimming to save space.  The Index operations always return
  638. SUCCESS so there's no need to check their return code.
  639. @
  640. text
  641. @d10 1
  642. a10 1
  643. static char rcsid[] = "$Header: fs.c,v 1.6 87/05/11 11:16:35 brent Exp $ SPRITE (Berkeley)";
  644. a14 1
  645. #include "fsInt.h"
  646. a15 1
  647. #include "fsLocalDomain.h"
  648. d80 1
  649. a80 1
  650.     if (curHandlePtr->rec.fileType != FS_DIRECTORY) {
  651. d153 2
  652. a154 2
  653.     if (lastByte > handlePtr->rec.lastByte) {
  654.     lastByte = handlePtr->rec.lastByte;
  655. d177 1
  656. a177 1
  657.         status = FsBlockIO(FS_READ, &handlePtr->rec.device, blockAddr,
  658. d184 1
  659. a184 1
  660.         status = FsBlockIO(FS_READ, &handlePtr->rec.device, blockAddr,
  661. d285 1
  662. a285 1
  663.     handlePtr->rec.fileID.fileNumber = fileNumber;
  664. d288 4
  665. a291 4
  666.     handlePtr->nameToken = (ClientData)descPtr;
  667.     handlePtr->rec.device = fsDevice;
  668.     handlePtr->rec.fileType = descPtr->fileType;
  669.     handlePtr->rec.lastByte = descPtr->lastByte;
  670. @
  671.  
  672.  
  673. 1.6
  674. log
  675. @Trimmed down version that works.
  676. @
  677. text
  678. @d10 1
  679. a10 1
  680. static char rcsid[] = "$Header: fs.c,v 1.5 87/05/08 17:44:41 brent Exp $ SPRITE (Berkeley)";
  681. d160 1
  682. a160 4
  683.     status = FsGetFirstIndex(handlePtr, firstBlock, &indexInfo);
  684.     if (status != SUCCESS) {
  685.     return(status);
  686.     }
  687. d314 1
  688. a314 1
  689.     int fileNumber;
  690. @
  691.  
  692.  
  693. 1.5
  694. log
  695. @Updated to reflect new fs data structures (handle changed)
  696. @
  697. text
  698. @d10 1
  699. a10 1
  700. static char rcsid[] = "$Header: fs.c,v 1.4 86/07/24 11:32:59 brent Exp $ SPRITE (Berkeley)";
  701. d72 1
  702. d89 1
  703. d91 1
  704. a91 3
  705.             component[index] = *curCharPtr;
  706.             index++;
  707.             curCharPtr++;
  708. d93 4
  709. a96 1
  710.         component[index] = '\0';
  711. d109 3
  712. d333 1
  713. d337 1
  714. @
  715.  
  716.  
  717. 1.4
  718. log
  719. @Completed Fs_Read (there were a number of bugs.)
  720. @
  721. text
  722. @d10 1
  723. a10 1
  724. static char rcsid[] = "$Header: fs.c,v 1.3 86/07/21 09:35:02 brent Exp $ SPRITE (Berkeley)";
  725. d81 1
  726. a81 1
  727.     if (curHandlePtr->fileType != FS_DIRECTORY) {
  728. a127 1
  729.  
  730. d149 2
  731. a150 2
  732.     if (lastByte > handlePtr->lastByte) {
  733.     lastByte = handlePtr->lastByte;
  734. d176 1
  735. a176 1
  736.         status = FsBlockIO(FS_READ, &handlePtr->device, blockAddr,
  737. d183 1
  738. a183 1
  739.         status = FsBlockIO(FS_READ, &handlePtr->device, blockAddr,
  740. d284 1
  741. a284 1
  742.     handlePtr->fileID.fileNumber = fileNumber;
  743. d287 4
  744. a290 4
  745.     handlePtr->domainToken = (ClientData)descPtr;
  746.     handlePtr->device = fsDevice;
  747.     handlePtr->fileType = descPtr->fileType;
  748.     handlePtr->lastByte = descPtr->lastByte;
  749. @
  750.  
  751.  
  752. 1.3
  753. log
  754. @Added stuf for Fs_Open
  755. @
  756. text
  757. @d10 1
  758. a10 1
  759. static char rcsid[] = "$Header: fs.c,v 1.2 86/07/18 11:58:21 nelson Exp $ SPRITE (Berkeley)";
  760. d150 3
  761. d162 3
  762. d171 1
  763. a171 1
  764.         size = lastByte & FS_BLOCK_OFFSET_MASK + 1;
  765. d182 1
  766. a182 1
  767.         Byte_Copy(size, &(readBuffer[blockOffset]), buffer);
  768. d226 1
  769. a226 1
  770.     int length;            /* Length variable for read call */
  771. d257 1
  772. d287 1
  773. a287 1
  774.     FsGetFileDesc(fsDomainPtr, fileNumber, descPtr);
  775. d291 1
  776. d328 3
  777. @
  778.  
  779.  
  780. 1.2
  781. log
  782. @Trimmed.
  783. @
  784. text
  785. @d10 1
  786. a10 1
  787. static char rcsid[] = "$Header: fs.c,v 1.1 86/07/18 09:32:17 brent Exp $ SPRITE (Berkeley)";
  788. d17 1
  789. d19 1
  790. d21 10
  791. a30 1
  792. extern    FsDomainHeader    *fsDomainPtr;
  793. d33 11
  794. d48 67
  795. d169 1
  796. a169 1
  797.             fsDomainPtr->dataOffset * FS_FRAGMENTS_PER_BLOCK;
  798. d171 1
  799. a171 1
  800.         status = FsBlockIO(handlePtr, blockAddr,
  801. d178 2
  802. a179 2
  803.         status = FsBlockIO(handlePtr, blockAddr, FS_FRAGMENTS_PER_BLOCK,
  804.                  &(buffer[bufferIndex]));
  805. d194 126
  806. @
  807.  
  808.  
  809. 1.1
  810. log
  811. @Initial revision
  812. @
  813. text
  814. @d10 1
  815. a10 1
  816. static char rcsid[] = "$Header: vmSunBoot.c,v 1.9 86/05/01 23:20:11 nelson Exp $ SPRITE (Berkeley)";
  817. d19 1
  818. d42 5
  819. a46 5
  820.     register    FsHandle    *handlePtr;
  821.     int        offset;
  822.     int        numBytes;
  823.     Address    buffer;
  824.     int        *readCountPtr;
  825. d48 10
  826. a57 9
  827.     int            firstBlock;
  828.     int            lastBlock;
  829.     int            lastByte;
  830.     ReturnStatus    status;
  831.     BlockIndexInfo    indexInfo;
  832.     int            bufferIndex;
  833.     int            blockOffset;
  834.     int            size;
  835.     int            readSize;
  836. d79 2
  837. d82 1
  838. a82 1
  839.         status = FsFileBlockIO(handlePtr, indexInfo.blockAddr,
  840. d89 1
  841. a89 2
  842.         status = FsFileBlockIO(handlePtr, indexInfo.blockAddr,
  843.                  FS_FRAGMENTS_PER_BLOCK,
  844. @
  845.